<template>
	<view class="topic-list m-f-ac animate__animated animate__slideInLeft animate__faster" @tap="openDetail">
		<image class="list-img" :src="item.titlepic" lazy-load></image>
		<view>
			<view class="list-title">
				#{{item.title}}
			</view>
			<view class="list-desc">
				{{item.desc}}
			</view>
			<view class="list-date">
				动态 {{item.totlenum}} 今日 {{item.todaynum}}
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		props: {
			item: {
				type: Object
			},
			ischange: {
				type: Boolean,
				default: false,
			}
		},
		methods: {
			openDetail() {
				if (this.ischange) {
					// 通知并返回
					uni.$emit('changeTopic', { id: this.item.id, title: this.item.title })
					uni.navigateBack({ delta: 1 })
					return
				}
				uni.navigateTo({
					url: '../../pages/topic-detail/topic-detail?detail=' + JSON.stringify(this.item),
				});
			}
		},
	}
</script>

<style lang="scss" scoped>
	.topic-list {
		padding: 20rpx 0;
		border-bottom: 1rpx solid #EEEEEE;
		.list-img {
			width: 150rpx;
			height: 150rpx;
			border-radius: 10rpx;
			margin-right: 20rpx;
		}
		.list-title, .list-desc, .list-date {
			color: #A4A4A4;
		}
		.list-title {
			color: #333333;
			font-size: 32rpx;
		}
	}
</style>
